#include "tools.h"
#include<QTime>

tools::tools()
{
    //ui->setupUi(this);
    //this->setGeometry(QRect(435,100,600,700));
}
bool tools::light(int n)
{
    if(n==9)
    {
        return true;
    }
}
void tools::pausanto(QRect rect1,QRect rect2,bool &istouch)
{
    if(rect1.left()-40<=rect2.left()&&rect1.top()-40<rect2.top()&&rect1.right()+40>rect2.right()&&rect1.bottom()+40>rect2.bottom())
    {
        istouch=true;
    }
}
void tools::thermometer(QRect)
{

}
void tools::initempureter(QVector<QVector<int>> &array,QRect rect )
{
    srand(QTime(0,0,0).secsTo(QTime::currentTime()));//初始鬼坐标     a[i][j]按照习惯i是y轴  j是x轴
    array.resize(560);
    for(int j=0;j<array.size();j++)
    {
        array[j].resize(560);
    }
    for(int i=0;i<560;i++)
    {
        for(int j=0;j<560;j++)
        {
            if(i+20>rect.left()-20&&i+20<rect.right()+20&&j+20>rect.top()-20&&j+20<rect.bottom()+20)
            {
                int n=-10+rand()%(4-(-10));
                array[i][j]=n;
            }
            else
            {
                int n=4+rand()%(25-4);
                array[i][j]=n;
            }
        }
    }

}
